// PointersandInheritance.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "Person.h"
#include "Tweeter.h"
#include <iostream>
#include <string>
#include <memory>

using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
	Person* Kate=new Person("Kate","Hudson",345);
	Tweeter* KateHudsonTw=new Tweeter("Kate","Hudson",567,"@hudsonKate");

	Person* pKateHudsonTw=KateHudsonTw;
	Tweeter* pKateHudsonTwT=KateHudsonTw;

	cout<<Kate->GetName()<<endl;
	cout<<KateHudsonTw->GetName()<<endl;
	cout<<pKateHudsonTw->GetName()<<endl;
	cout<<pKateHudsonTwT->GetName()<<endl;

	delete KateHudsonTw;

	//shared_ptr<Person> spKate=make_shared<Person>("Kate_sp","Hudson_sp",789);
	//auto spKate=make_shared<Person>("Kate_sp","Hudson_sp",789); //auto is new feature in c++11 works like dynamic
	shared_ptr<Person> spKate=make_shared<Tweeter>("Kate_sp","Hudson_sp",789,"@hudsonKate"); //auto is new feature in c++11 works like dynamic
	cout<<spKate->GetName()<<endl;

	Person localP("Kate","Hudson",333);
	//Tweeter localT=localP;

	Tweeter localT2("Kate","Hudson",444,"@hudsonKate");
	Person* localP2=&localT2;
	cout<<localP2->GetName()<<endl;
	
	int a;
	cin>>a;

	return 0;
}

